package com.allbluefish.learn.model;

public class Account {
  
    private int balance;  
    
    public Account(int balance) {  
        this.balance = balance;  
    } 
    
    public int getBalance() {
		return balance;
	}

	public void setBalance(int balance) {
		this.balance = balance;
	}

	public void add(int num) {  
        this.balance = this.balance + num;  
    }  
  
    public void withdraw(int num) {  
        this.balance = this.balance - num;  
    }  

    public synchronized void addSync(int num) {  
        this.balance = this.balance + num;  
    }  
  
    public synchronized void withdrawSync(int num) {  
        this.balance = this.balance - num;  
    }
}
